/*
 * Copyright 2012-2019 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.boot.rsocket.server;

import io.rsocket.SocketAcceptor;

/**
 * 工厂接口，用于创建响应式的 {@link RSocketServer} 实例。
 * <p>通常用于在 Spring 应用上下文中按需创建可配置的 RSocket 服务端。</p>
 *
 * @author Brian Clozel
 * @since 2.2.0
 */
@FunctionalInterface
public interface RSocketServerFactory {

	/**
	 * 获取一个已配置但尚未启动的 {@link RSocketServer} 实例。
	 * <p>在调用 {@link RSocketServer#start()} 之前，客户端无法连接此服务器。
	 * 一般在 {@code ApplicationContext} 完全刷新后启动。</p>
	 *
	 * @param socketAcceptor 用于处理传入连接的 socket 接收器
	 * @return 一个完全配置但未启动的 {@link RSocketServer} 实例
	 * @see RSocketServer#stop()
	 */
	RSocketServer create(SocketAcceptor socketAcceptor);

}
